<?php

/**
 * News form base class.
 *
 * @method News getObject() Returns the current form's model object
 *
 * @package    iEasy
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseNewsForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'news_id'         => new sfWidgetFormInputHidden(),
      'title'           => new sfWidgetFormTextarea(),
      'author'          => new sfWidgetFormInputText(),
      'source'          => new sfWidgetFormTextarea(),
      'tag'             => new sfWidgetFormTextarea(),
      'catalog_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Catalog'), 'add_empty' => true)),
      'sub_catalog_id'  => new sfWidgetFormInputText(),
      'publish_time'    => new sfWidgetFormDateTime(),
      'create_time'     => new sfWidgetFormDateTime(),
      'modify_time'     => new sfWidgetFormDateTime(),
      'snapshot_big'    => new sfWidgetFormTextarea(),
      'snapshot_normal' => new sfWidgetFormTextarea(),
      'snapshot_small'  => new sfWidgetFormTextarea(),
      'brief'           => new sfWidgetFormTextarea(),
      'brief_title'     => new sfWidgetFormTextarea(),
      'short_comment'   => new sfWidgetFormTextarea(),
      'hit_i'           => new sfWidgetFormInputText(),
      'hit_mask_i'      => new sfWidgetFormInputText(),
      'keyword'         => new sfWidgetFormTextarea(),
      'status_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Status'), 'add_empty' => true)),
      'member_level_i'  => new sfWidgetFormInputText(),
      'body'            => new sfWidgetFormTextarea(),
      'is_audit_b'      => new sfWidgetFormInputText(),
      'daily_hit'       => new sfWidgetFormInputText(),
      'weekly_hit'      => new sfWidgetFormInputText(),
      'monthly_hit'     => new sfWidgetFormInputText(),
      'system_user_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Systemuser'), 'add_empty' => true)),
      'user_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Users'), 'add_empty' => true)),
      'is_header_b'     => new sfWidgetFormInputText(),
      'is_recommend_b'  => new sfWidgetFormInputText(),
      'is_on_top_b'     => new sfWidgetFormInputText(),
      'is_focus_b'      => new sfWidgetFormInputText(),
      'body_test'       => new sfWidgetFormTextarea(),
    ));

    $this->setValidators(array(
      'news_id'         => new sfValidatorChoice(array('choices' => array($this->getObject()->get('news_id')), 'empty_value' => $this->getObject()->get('news_id'), 'required' => false)),
      'title'           => new sfValidatorString(array('required' => false)),
      'author'          => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'source'          => new sfValidatorString(array('required' => false)),
      'tag'             => new sfValidatorString(array('required' => false)),
      'catalog_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Catalog'), 'required' => false)),
      'sub_catalog_id'  => new sfValidatorInteger(array('required' => false)),
      'publish_time'    => new sfValidatorDateTime(array('required' => false)),
      'create_time'     => new sfValidatorDateTime(array('required' => false)),
      'modify_time'     => new sfValidatorDateTime(array('required' => false)),
      'snapshot_big'    => new sfValidatorString(array('required' => false)),
      'snapshot_normal' => new sfValidatorString(array('required' => false)),
      'snapshot_small'  => new sfValidatorString(array('required' => false)),
      'brief'           => new sfValidatorString(array('required' => false)),
      'brief_title'     => new sfValidatorString(array('required' => false)),
      'short_comment'   => new sfValidatorString(array('required' => false)),
      'hit_i'           => new sfValidatorInteger(array('required' => false)),
      'hit_mask_i'      => new sfValidatorInteger(array('required' => false)),
      'keyword'         => new sfValidatorString(array('required' => false)),
      'status_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Status'), 'required' => false)),
      'member_level_i'  => new sfValidatorInteger(array('required' => false)),
      'body'            => new sfValidatorString(array('required' => false)),
      'is_audit_b'      => new sfValidatorInteger(array('required' => false)),
      'daily_hit'       => new sfValidatorInteger(array('required' => false)),
      'weekly_hit'      => new sfValidatorInteger(array('required' => false)),
      'monthly_hit'     => new sfValidatorInteger(array('required' => false)),
      'system_user_id'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Systemuser'), 'required' => false)),
      'user_id'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Users'), 'required' => false)),
      'is_header_b'     => new sfValidatorInteger(array('required' => false)),
      'is_recommend_b'  => new sfValidatorInteger(array('required' => false)),
      'is_on_top_b'     => new sfValidatorInteger(array('required' => false)),
      'is_focus_b'      => new sfValidatorInteger(array('required' => false)),
      'body_test'       => new sfValidatorString(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('news[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'News';
  }

}
